<?php

	require("includes/database.php");

	$query = $_GET['q'];
	$opcion = $_GET['op'];
	
	if ($query != "")
	{
		$result = readSQL($query);
		switch($opcion)
		{
			case 1:
			{
				//Busco si existe el Cliente segun su DNI
				//Se usa en atencion.php
				foreach($result as $value)
				{
					echo $value['apellido'];
					echo "||";
					echo $value['nombre'];
					echo "||";
					echo $value['fechanacimiento'];
					echo "||";
					echo $value['telefono'];
					echo "||";
					echo $value['email'];
					echo "||";
					echo $value['idprovincia'];
					echo "||";
					echo $value['idciudad'];
					echo "||";
					echo $value['calle'];
					echo "||";
					echo $value['numero'];
					echo "||";
					echo $value['depto'];
					echo "||";
					echo $value['cp'];
					echo "||";
					echo $value['contacto'];
					echo "||";
					echo $value['idcliente'];
				}
				break;
			}
			case 2:
			{
				foreach($result as $value)
				{
					echo $value['idciudad'];
					echo "||";
					echo $value['nombre'];
					echo "&&";
				}
				break;
			}
		}
	}
?>
